package com.firefly.admin.common.properties;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@Component
@ConfigurationProperties(prefix = "knife4j")
public class Knife4jProperties {
    private boolean enable;
    private String basePackage;
    @Autowired
    private Setting setting;
    @Autowired
    private Basic basic;
    @Autowired
    private Config config;
    @Autowired
    private Contact contact;
    @Autowired
    private ApiInfo apiInfo;
    private List<Parameter> parameters;

    @Data
    @Component
    @ConfigurationProperties(prefix = "spring.knife4j.setting")
    public static class Setting {
        private boolean enableFooter;
        private boolean enableFooterCustom;
        private String footerCustomContent;
    }

    @Data
    @Component
    @ConfigurationProperties(prefix = "spring.knife4j.basic")
    public static class Basic {
        private boolean enable;
        private String username;
        private String password;
    }

    @Data
    @Component
    @ConfigurationProperties(prefix = "spring.knife4j.config")
    public static class Config {
        private String groupName;
        private String host;
    }

    @Data
    @Component
    @ConfigurationProperties(prefix = "spring.knife4j.contact")
    public static class Contact {
        private String name;
        private String url;
        private String email;
    }

    @Data
    @Component
    @ConfigurationProperties(prefix = "spring.knife4j.api-info")
    public static class ApiInfo {
        private String title;
        private String description;
        private String termsServiceUrl;
        private String version;
    }

    @Data
    public static class Parameter {
        private String name;
        private String description;
        private String modelRef;
        private String parameterType;
        private boolean required;
    }

}
